class PreviewData {
  // 静态属性，用于存储唯一实例
  static instance: PreviewData | null = null;
  data: any;
  constructor(data?:any) {
    if (PreviewData.instance) {
      return PreviewData.instance;
    }
    PreviewData.instance = this;
    this.data = data;
  }

  // 静态方法，用于获取唯一实例
  static getInstance(data?:any): PreviewData {
    if (!PreviewData.instance) {
      PreviewData.instance = new PreviewData();
    }
    return PreviewData.instance;
  }

  setData(data?: any) {
    this.data = data;
  }

  getData(): string {
    return this.data;
  }
}

export { PreviewData };
